Skip to content

fix(cloudflare): align integration with live API, fix type-coercion bug#5444

Merged
waleedlatif1 merged 7 commits into
stagingfrom
validate/cloudflare-integration
Jul 6, 2026
Merged

fix(cloudflare): align integration with live API, fix type-coercion bug#5444
waleedlatif1 merged 7 commits into
stagingfrom
validate/cloudflare-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Ran /validate-integration on the Cloudflare integration (13 tools + block) against Cloudflare's live API docs
  • Fixed a real bug in update_zone_setting: the body builder blindly JSON.parse'd every value, which could silently coerce scalar settings (e.g. min_tls_version: "1.2") to the wrong type and get rejected by the API — now only object/array literals are JSON-parsed
  • Fixed list_dns_records name/content/tag filters to use Cloudflare's exact-match dotted param names (name.exact/content.exact/tag.exact) instead of bare params the API doesn't honor the same way
  • Removed auto_minify (never a real Cloudflare setting ID) and minify (deprecated, removed from the live zone-settings API in Aug 2024) from the Update Zone Setting dropdown
  • Removed a dead jump_start param from create_zone — not part of the current POST /zones schema
  • Fixed the block's bgColor from an incorrect near-white (#F5F6FA) to Cloudflare's actual brand orange (#F38020)
  • Added a missing secondary zone type option and plan.id sort option
  • Expanded BlockMeta skills/templates

All changes were independently verified by 3 parallel audit passes against Cloudflare's live API docs, plus a dedicated backwards-compatibility check confirming no currently-working field was removed (the removed fields were all dead/broken against the live API already).

Type of Change

  • Bug fix

Testing

Tested manually — lint and typecheck pass clean on all touched files.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

- fix update_zone_setting body builder: was blindly JSON.parse-ing every
  value, silently coercing scalar settings (e.g. min_tls_version "1.2")
  to the wrong type; now only parses object/array literals
- fix list_dns_records name/content/tag filters to use Cloudflare's
  exact-match dotted param names (name.exact/content.exact/tag.exact)
- remove auto_minify (never a real setting ID) and minify (deprecated
  and removed from the live zone-settings API in Aug 2024)
- remove dead jump_start param from create_zone (not part of the
  current POST /zones schema)
- fix block bgColor from #F5F6FA to Cloudflare's actual brand orange
  #F38020
- add missing secondary zone type option and plan.id sort option
- expand BlockMeta skills/templates
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 6, 2026 10:45pm

Request Review

@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes affect live Cloudflare API calls for DNS listing filters and zone-setting updates (including SSL/TLS-related settings), where incorrect coercion previously caused API rejections; removals (jump_start, minify) only drop dead options against the current API.

Overview
Aligns the Cloudflare block, tools, docs, and integration catalog with the current Cloudflare API and fixes request-building bugs that could cause failed or incorrect API calls.

cloudflare_update_zone_setting no longer runs JSON.parse on every value. It passes through object/array values from block references, coerces browser_cache_ttl to a number, and only parses JSON when the input looks like {...} or [...] so scalars like min_tls_version: "1.2" stay strings.

cloudflare_list_dns_records now sends name.exact, content.exact, and tag.exact (and keeps comment.contains) instead of bare query keys that did not match the API’s filter semantics.

Create zone drops the unsupported jump_start field from the tool, types, block UI, and param mapping. List zones gains plan.id sort in the block and tool docs. Create zone adds secondary as a zone type in the block.

Update zone setting UI and copy remove deprecated/invalid minify / auto_minify options; wand prompts and docs are updated accordingly. DNS tag filtering is documented and labeled as a single exact tag name.

Two new BlockMeta skills cover zone provisioning and SPF/DKIM/DMARC setup. integrations.json descriptions and updatedAt are refreshed to match.

Reviewed by Cursor Bugbot for commit f3f3596. Configure here.

Comment thread apps/sim/tools/cloudflare/update_zone_setting.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8d72b05. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR aligns the Cloudflare integration with the live API by fixing a real type-coercion bug in update_zone_setting, switching DNS record filters to Cloudflare's exact-match dotted parameters (name.exact, content.exact, tag.exact), removing deprecated and non-existent settings (minify, auto_minify, jump_start), and expanding the block UI with missing options (secondary zone type, plan.id sort).

  • Type-coercion fix (update_zone_setting.ts): The previous implementation blindly JSON.parse'd every value, silently converting scalar settings like min_tls_version: "1.2" to the number 1.2, which the Cloudflare API rejects. The new code only JSON-parses values that begin with { or [, and special-cases browser_cache_ttl for numeric coercion.
  • DNS filter alignment (list_dns_records.ts): name, content, and tag filters now use Cloudflare's exact-match query-param form (name.exact, content.exact, tag.exact) instead of the bare params that the API does not honour in the same way.
  • Cleanup: Removed jump_start from create_zone (not in current POST /zones schema), dropped deprecated minify/auto_minify from the settings dropdown, and updated descriptions, docs, and templates accordingly.

Confidence Score: 5/5

Safe to merge — all changes are targeted API-alignment fixes with no new logic paths that could cause regressions on currently-working settings.

The body-builder rewrite in update_zone_setting.ts is the only non-trivial logic change, and it correctly handles every runtime type that can flow through the param. The DNS filter changes swap bare params for Cloudflare's documented exact-match equivalents. Removed fields were already broken against the live API. No currently-working code path is regressed.

No files require special attention. update_zone_setting.ts received the most logic change and is well-commented.

Important Files Changed

Filename Overview
apps/sim/tools/cloudflare/update_zone_setting.ts Core bug fix: replaces blind JSON.parse with a targeted body-builder that preserves string scalars, numeric-coerces browser_cache_ttl, and only JSON-parses object/array literals. Logic is correct.
apps/sim/tools/cloudflare/list_dns_records.ts Switches name, content, and tag filters to Cloudflare's exact-match dotted params; descriptions already said 'exact match' so semantics are now consistent with the stated intent.
apps/sim/tools/cloudflare/create_zone.ts Removes jump_start param (claimed absent from live POST /zones schema); body builder and param type updated consistently.
apps/sim/blocks/blocks/cloudflare.ts Adds secondary zone type option, plan.id sort field, removes deprecated jump_start UI field and minify/auto_minify dropdown entries; two new BlockMeta templates added.
apps/sim/tools/cloudflare/types.ts Removes jump_start from CloudflareCreateZoneParams to stay in sync with the tool and block changes.
apps/sim/tools/cloudflare/list_zones.ts Adds plan.id to the sort-field description; a minor doc-alignment change with no functional risk.
apps/sim/tools/cloudflare/get_zone_settings.ts Description and example setting IDs updated to remove minify references; no logic changes.
apps/docs/content/docs/en/integrations/cloudflare.mdx Documentation brought in sync with all code changes: jump_start removed, minify removed, exact-match semantics documented.
apps/sim/lib/integrations/integrations.json Bumps updatedAt timestamp and removes minification references from tool descriptions.

Reviews (7): Last reviewed commit: "revert(cloudflare): keep original block ..." | Re-trigger Greptile

Comment thread apps/sim/tools/cloudflare/update_zone_setting.ts
@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR aligns the Cloudflare integration with the live API by fixing a type-coercion bug, correcting DNS record filter params, and removing stale/deprecated fields and settings.

  • update_zone_setting: Replaces the blanket JSON.parse with a targeted dispatch — browser_cache_ttl is explicitly coerced to an integer, JSON object/array literals (e.g. ciphers) are parsed, and all other scalar settings stay as strings, preventing the previous silent coercion of "1.2"1.2 that caused API rejections.
  • list_dns_records: name, content, and tag query params are renamed to their dotted exact-match equivalents (name.exact, content.exact, tag.exact) as the Cloudflare v4 API requires for deterministic filtering.
  • Deprecations removed: jump_start (no longer in the POST /zones schema), minify and auto_minify (removed from the zone-settings API in Aug 2024) are dropped from params, types, the block dropdown, and docs; secondary zone type and plan.id sort field are added.

Confidence Score: 4/5

Safe to merge; all changes are API-alignment fixes and deprecation removals with no core path regressions.

The update_zone_setting body builder is materially improved — the previous blind JSON.parse coerced "1.2" to 1.2 and broke the Cloudflare API; the new dispatch is correct for every setting in the exposed dropdown. The trimmed variable is computed but the three fallback return paths use params.value instead, meaning whitespace-padded inputs for string settings (e.g. " on ") are sent unstripped to the API. This is a pre-existing quirk carried over from the old catch block, but since trimmed is now available it should be used consistently. The remaining changes (DNS exact-match params, deprecated field removal, brand color, new zone type, sort option) are straightforward and well-documented.

apps/sim/tools/cloudflare/update_zone_setting.ts — the trimmed/params.value inconsistency in the fallback returns warrants a look before merge.

Important Files Changed

Filename Overview
apps/sim/tools/cloudflare/update_zone_setting.ts Core bug fix: replaces blind JSON.parse with targeted numeric/JSON-object dispatch; correctly handles browser_cache_ttl as integer and array/object literals; final string fallback returns params.value rather than trimmed, which is a minor inconsistency but matches old behavior.
apps/sim/tools/cloudflare/list_dns_records.ts Switches name, content, and tag query params to their dotted exact-match equivalents (name.exact, content.exact, tag.exact) to match Cloudflare v4 API; description update aligns with the new single-value expectation.
apps/sim/blocks/blocks/cloudflare.ts Brand color corrected to Cloudflare orange, deprecated minify/auto_minify options removed, jump_start coercion logic removed, secondary zone type added, plan.id sort option added, two new BlockMeta templates added.
apps/sim/tools/cloudflare/create_zone.ts Removes jump_start param definition and body injection; straightforward cleanup with no side-effects on remaining create_zone logic.
apps/sim/tools/cloudflare/types.ts Removes the jump_start boolean field from CloudflareCreateZoneParams; consistent with the create_zone.ts and block changes.
apps/sim/tools/cloudflare/list_zones.ts Adds plan.id as a valid sort field in the description to match the live Cloudflare API; only a metadata change, no runtime logic altered.
apps/sim/tools/cloudflare/get_zone_settings.ts Description-only update removing minification references; no functional changes.
apps/sim/lib/integrations/integrations.json Updates metadata: bgColor to #F38020, updatedAt timestamp, and description strings to match the tool changes.
apps/docs/content/docs/en/integrations/cloudflare.mdx Documentation kept in sync with all code changes: brand color, removed jump_start, tag filter semantics, minify/auto_minify removal, and plan.id sort option.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[update_zone_setting called] --> B[trimmed = params.value.trim]
    B --> C{settingId is browser_cache_ttl?}
    C -->|Yes| D[numeric = Number of trimmed]
    D --> E{isNaN?}
    E -->|Yes| F[send string fallback]
    E -->|No| G[send as integer]
    C -->|No| H{trimmed starts with curly or bracket?}
    H -->|Yes - JSON literal| I[JSON.parse trimmed]
    I --> J{Parse OK?}
    J -->|Yes| K[send as parsed object or array]
    J -->|No| L[send string fallback]
    H -->|No - plain scalar| M[send as string e.g. full or on or 1.2]
    G --> N[PATCH /zones/:id/settings/:settingId]
    K --> N
    M --> N
    F --> N
    L --> N
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[update_zone_setting called] --> B[trimmed = params.value.trim]
    B --> C{settingId is browser_cache_ttl?}
    C -->|Yes| D[numeric = Number of trimmed]
    D --> E{isNaN?}
    E -->|Yes| F[send string fallback]
    E -->|No| G[send as integer]
    C -->|No| H{trimmed starts with curly or bracket?}
    H -->|Yes - JSON literal| I[JSON.parse trimmed]
    I --> J{Parse OK?}
    J -->|Yes| K[send as parsed object or array]
    J -->|No| L[send string fallback]
    H -->|No - plain scalar| M[send as string e.g. full or on or 1.2]
    G --> N[PATCH /zones/:id/settings/:settingId]
    K --> N
    M --> N
    F --> N
    L --> N
Loading

Reviews (2): Last reviewed commit: "fix(cloudflare): reject empty browser_ca..." | Re-trigger Greptile

Comment thread apps/sim/tools/cloudflare/update_zone_setting.ts Outdated
Comment thread apps/sim/tools/cloudflare/update_zone_setting.ts
- use trimmed value consistently in update_zone_setting fallback paths
- document that tag_match has no effect with a single exact-match tag
  filter (Cloudflare's API only combines multiple tag conditions)
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Addressed the tag_match/tag.exact semantics note from the Greptile summary (Comments Outside Diff) in 493cb56 — updated the tag_match param description to document that it only affects results when combined with multiple tag filter conditions and has no effect with the single exact-match Tag Filter. Verified against Cloudflare's live DNS records list API docs: tag.exact matches a single name:value pair, so exposing multiple simultaneous tag conditions (present/absent/exact/startswith/etc.) would be a larger feature addition out of scope for this alignment/bug-fix pass.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/cloudflare/update_zone_setting.ts Outdated
Wand-generated or block-referenced values can arrive as a number at
runtime despite the declared string param type, which crashed the
body builder's .trim() call.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

…description

- coerce null/undefined value to empty string instead of literal
  "null"/"undefined" strings before trimming
- fix stale block-level 'tag' input description left over from the
  comma-separated-tags -> exact-match-tag filter fix
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/cloudflare/update_zone_setting.ts
A block-referenced array/object value was being blindly stringified
before the JSON-shape check, so String([...]) comma-joined arrays and
String({...}) produced the literal "[object Object]" instead of the
JSON shape Cloudflare expects (e.g. for ciphers). Already-structured
values now pass straight through.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cb2004b. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 merged commit 6d5ac58 into staging Jul 6, 2026
6 of 7 checks passed
@waleedlatif1 waleedlatif1 deleted the validate/cloudflare-integration branch July 6, 2026 22:41

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f3f3596. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant